Multiple clients over singele TCP/IP connection - Mailing list pgsql-novice

From M. Bastin
Subject Multiple clients over singele TCP/IP connection
Date
Msg-id a06110403bd1d6f46b8c9@[213.119.79.138]
Whole thread Raw
In response to Re: concurrent cursors possible with portals?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-novice
This is a "best practice" question.

Imagine you have 2 computers.  One is a web server and the other runs
PostgreSQL.  Multiple browsers from all over the net connect to the
web server, but to minimize load, the web server itself opens only 1
TCP/IP connection with PostgreSQL.  (This is a general question, it
doesn't have to be a web server.  It could be any kind of
"middleman".)

How would all the browsers be best served simultaneously?

The solution I think about is to use the extended query protocol,
open an infinitely lasting transaction, and have a portal per browser.

That would work to read data until an error occurs and the
transaction would roll back and then *all* browsers' sessions would
have to be reset.

(Therefore to write data I'd have to cheat and still open a second
TCP/IP connection over which each insert or update gets committed
instantly.)

Is there a better way to implement concurrent users over 1 single
TCP/IP session?

Thanks,

Marc


At 1:34 PM -0400 7/1/04, Tom Lane wrote:
>  > The only thing that bothers me is the Sync command that would put an
>>  end to all portals at once isn't it?
>
>Not if you are inside a transaction block (ie, have issued a BEGIN
>command).
>
>A possibly more serious issue is that an error detected in any one of
>the portals aborts the transaction and thus you lose all the portals.
>We may eventually have a solution for that involving subtransactions.
>
>            regards, tom lane


pgsql-novice by date:

Previous
From: Yves
Date:
Subject: Re: postgres account default password
Next
From: Frank Bax
Date:
Subject: Re: postgres account default password